﻿using Autodesk.Revit.UI;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace demo
{
    public  class 配置文件
    {

        public static string AssemblyPath { get => typeof(Test).Assembly.Location; }

        public  static void Test(ExternalCommandData commandData)
        {

            string assmblyPath = typeof(配置文件).Assembly.Location; // AssemblyPath;
           // Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            var config = ConfigurationManager.OpenExeConfiguration(assmblyPath);

            string Height0 = config.AppSettings.Settings["AAA"].Value;
            string Angle0 = config.AppSettings.Settings["BBB"].Value;

            //#region 修改节点Value
            //config.AppSettings.Settings["AAA"].Value = getNewHeight;
            //config.AppSettings.Settings["BBB"].Value = getNewAngle;
            //config.Save(ConfigurationSaveMode.Modified);
            ////刷新，否则程序读取的还是之前的值（可能已装入内存）
            //System.Configuration.ConfigurationManager.RefreshSection("appSettings");
            //#endregion

            //字符串类型数据直接读取
            TaskDialog.Show("读取结果", Height0);


        }


    }
}
